<ion-modal-view  ng-controller="MsgCtrl">
    <ion-header-bar  align-title="center" class="bar-energized-crm">
        <h1 class="title">消息</h1>
        <div class="buttons">
            <button class="button button-clear" ng-click="closeMsgModal()">
                关闭
            </button>
        </div>
    </ion-header-bar>
    <!--消息提示 end-->
    <div class="tabs-top tabs-striped tabs-background-crm tabs-color-light">
        <div class="tabs">
            <a class="tab-item content-tab" ng-class="{'active':active == $index}" ng-click="onTabChange($index, tab.readStatus);" ng-repeat="tab in tabs">{{tab.name}}</a>
        </div>
    </div>
    <ion-content class="crm-content has-tabs-top">
        <ion-refresher
                pulling-text="下拉刷新"
                on-refresh="msg.refresh()">
        </ion-refresher>
        <div ng-repeat="tab in tabs" ng-show="active == $index">
            <ion-list ng-repeat="item in msg.data" ng-if="tab.readStatus == item.readStatus">
                <ion-item class="crm-msg-option-item">
                    <h2 style="white-space: normal;">{{item.msgPush.pushContent}}</h2>
                    <p class="pull-right">{{item.sendTime | date:'yyyy-MM-dd HH:mm:ss'}}</p>
                    <ion-option-button ng-if="tab.readStatus === 1" class="button-stable"
                                       ng-click="msg.markRead(item)">
                        标记已读
                    </ion-option-button>
                    <ion-option-button class="button-assertive"
                                       ng-click="msg.deleteRead(item)">
                        删除
                    </ion-option-button>
                </ion-item>
            </ion-list>
            <ul ng-if="msg.data.length <= 0">
                <li class="item">
                    <h2 style="color: #aaaaaa; text-align: center;" ng-if="tab.readStatus === 1">暂无未读消息</h2>
                    <h2 style="color: #aaaaaa; text-align: center;" ng-if="tab.readStatus === 2">暂无已读消息</h2>
                </li>
            </ul>
        </div>
        <ion-infinite-scroll
                ng-if="msg.moreDataCanBeLoaded"
                on-infinite="msg.loadMore()"
                distance="5%"
                spinner="dots">
        </ion-infinite-scroll>
    </ion-content>
</ion-modal-view>